package java.hilyb.ui;

import android.app.Activity;
import android.content.Intent;
import android.gesture.GestureOverlayView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import java.hilyb.dbtest.R;

/**
 * User: Administrator
 * Date: 15-1-24
 * Time: 上午10:55
 */
public class IntentDemo extends Activity implements View.OnTouchListener  {
    public static final String ACTION = "java.hilyb.MYACTION";
    public static final String CATEGORY = "java.hilyb.MYCATEGORY";

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.intent_demo);
        Button btn = (Button) findViewById(R.id.button1);
       /* btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setAction(ACTION);
                intent.addCategory(CATEGORY);
                startActivity(intent);
            }
        });*/
        btn.setOnTouchListener(this);
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_POINTER_UP:
                show("down");
                break;
            case MotionEvent.ACTION_POINTER_DOWN:
                show("up");
                break;
           // case MotionEvent.ACTION_MOVE: show("moving");
        }
        return false;
    }

    private void show(String str) {
        Toast.makeText(this, str, Toast.LENGTH_LONG).show();
    }
}